package com.shinbada.modules.sys.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.shinbada.config.swagger.IgnoreSwaggerParameter;
import com.shinbada.core.persistence.TreeEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.util.List;

/**
 * 机构Entity
 *
 * @author initcap
 * @version 2016-05-15
 */
@Data
@ApiModel("机构域模型实体")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"})
public class Office extends TreeEntity<Office> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("机构编码")
    @Length(min = 0, max = 100)
    private String code;
    @Length(min = 1, max = 1)
    @ApiModelProperty("机构类型（1：公司；2：部门；3：小组）")
    private String type;
    @Length(min = 0, max = 255)
    @ApiModelProperty("联系地址")
    private String address;
    @Length(min = 0, max = 100)
    @ApiModelProperty("邮政编码")
    private String zipCode;
    @ApiModelProperty("负责人")
    @Length(min = 0, max = 100)
    private String master;
    @ApiModelProperty("电话")
    @Length(min = 0, max = 200)
    private String phone;
    @ApiModelProperty("传真")
    @Length(min = 0, max = 200)
    private String fax;
    @Length(min = 0, max = 200)
    @ApiModelProperty("邮箱")
    private String email;
    @ApiModelProperty("是否可用")
    private String useable;
    @IgnoreSwaggerParameter
    @ApiModelProperty("主负责人")
    private User primaryPerson;
    @IgnoreSwaggerParameter
    @ApiModelProperty("副负责人")
    private User deputyPerson;
    @ApiModelProperty("快速添加子部门")
    private List<String> childDeptList;

    private boolean supper = false;

    public Office() {
        super();
        this.type = "2";
    }

    public Office(String id) {
        super(id);
    }

    @Override
    public Office getParent() {
        return parent;
    }

    @Override
    public void setParent(Office parent) {
        this.parent = parent;
    }

    @Override
    public String toString() {
        return name;
    }

}
